using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using FreeSql;
using FreeSql.DataAnnotations;

namespace BootBlazorApp1.Model;

public class Menu:BaseEntity<Menu,int>
{
   [Description("菜单名")]
   [Required(ErrorMessage = "菜单名不能为空")]
   public string Title { get; set; }
   [Description("URL")]
   [Required(ErrorMessage = "URL不能为空")]
   public string Url { get; set; }
   [Description("图标")]
   [Required(ErrorMessage = "图标不能为空")]
   public string Icon { get; set; }

   public int ParentId { get; set; }
   [Navigate(nameof(ParentId))]
   public Menu? Parent { get; set; }
   [Navigate(nameof(ParentId))]
   public List<Menu>? Children { get; set; }
   [Navigate(ManyToMany = typeof(RoleMenu))]
   public List<Role>? Roles { get; set; }
}